package com.fametal.ui.manager;

import java.util.HashMap;
import java.util.Stack;

import android.app.ActivityGroup;
import android.view.View;
import android.widget.LinearLayout;

public class ActivityManager {
	private static ActivityManager mActivityManager;
	private static HashMap<Class, Stack<View>> mHistoryVisted;
	public ActivityGroup mActivtiyGroup;
	public static LinearLayout mContainer;
	
	private ActivityManager() {}
	
	public static ActivityManager newInstance() {
		if(mActivityManager == null) {
			mActivityManager = new ActivityManager();
		}
		return mActivityManager;
	}
	
	public void addVistedHistory(Class className, View view) {
		if(mHistoryVisted == null) {
			mHistoryVisted = new HashMap<Class, Stack<View>>();
		}
		Stack<View> views = mHistoryVisted.get(className);
		if(views == null) {
			views = new Stack<View>();
		}
		views.add(view);
		mHistoryVisted.put(className, views);
	}
	
	public View getVistedHistory(Class className) {
		Stack<View> views = mHistoryVisted.get(className);
		View view = views.pop();
		return view;
	}
	
}
